﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TFSTools.TestManagement.TestCaseReview
{
    /// <summary>
    /// Interaction logic for OptionsWindow
    /// </summary>
    public partial class OptionsWindow : Window
    {
        #region DataContext

        private OptionsDataContext viewDataContext;

        public OptionsDataContext ViewDataContext
        {
            get { return this.viewDataContext; }
            set
            {
                this.viewDataContext = value;
                this.DataContext = value;
            }
        }

        public new object DataContext
        {
            get { return base.DataContext; }
            private set
            {
                base.DataContext = value;
            }
        }

        #endregion

        #region Constructor

        public OptionsWindow()
        {
            this.InitializeComponent();
        }

        #endregion

        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.ViewDataContext.Save())
                {
                    this.Close();
                }
                else
                {
                    MessageBox.Show("The specified Step Comment Refence Name has not been added to the Test Case work item type for this project.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occured.  " + ex.Message);
            }
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
